package com.trg.flex.dt
{
	import flash.events.MouseEvent;
	
	import mx.controls.Button;

	/**
	 * This is used internally by Column to show a cell as a button.
	 */
	public class ButtonRenderer extends Button
	{
		public function ButtonRenderer(column:Column=null)
		{
			super();
			this.column = column;
		}
		
		public var column:Column;
		public var _data:*;
		
		
		override public function set data(value:Object):void {
			label = column.itemToLabel(value)
			_data = value;
			//dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
		}
		override public function get data():Object {
			return _data;
		}
		
		/**
		 * This stops the row from being selected when the button is clicked.
		 */
		override protected function mouseDownHandler(event:MouseEvent):void {
			super.mouseDownHandler(event);
			event.stopPropagation();
		}
	}
}